package com.yoyosys.shared.controller;
import com.yoyosys.common.vo.Message;
import com.yoyosys.shared.po.ApiInfo;
import com.yoyosys.shared.po.ApiLimit;
import com.yoyosys.shared.po.ExchangeTask;
import com.yoyosys.shared.po.TaskInstance;
import com.yoyosys.shared.service.ApiInfoService;
import com.yoyosys.shared.service.ApiLimitService;
import com.yoyosys.shared.service.ExchangeTaskService;
import com.yoyosys.shared.service.TaskInstanceService;
import com.yoyosys.shared.vo.ApiInfoVo;
import com.yoyosys.shared.vo.ExchangeTaskVo;
import com.yoyosys.shared.vo.TaskInstanceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/api/shareapp")
public class SharedController {

    @Autowired
    private ExchangeTaskService exchangeTaskService;

    @Autowired
    private TaskInstanceService taskInstanceService;

    @Autowired
    private ApiInfoService apiInfoService;
    @Autowired
    private ApiLimitService apiLimitService;

    @PostMapping("/jobinfo")
    public Message jobinfo(@RequestBody ExchangeTaskVo exchangeTask){
        return exchangeTaskService.jobinfo(exchangeTask);

    }
    @PostMapping("/joblog")
    public Message joblog(@RequestBody TaskInstanceVo taskInstance){
        return taskInstanceService.joblog(taskInstance);

    }
    @PostMapping("/apiinfo")
    public Message apiinfo(@RequestBody ApiInfoVo apiInfo){
        return apiInfoService.apiinfo(apiInfo);

    }

    @PostMapping("/apiapply")
    public Message apiapply(@RequestBody ApiLimit apiLimit){
        return apiLimitService.apiapply(apiLimit);

    }
}
